/* 导入字体图标 */
@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css");

/* 颜色变量定义 - 便于主题切换和维护 */
:root {
    --primary: #6366f1; /* 主色调：靛蓝色 */
    --primary-light: #818cf8; /* 主色调浅色 */
    --primary-dark: #4f46e5; /* 主色调深色 */
    --secondary: #10b981; /* 辅助色：绿色 */
    --warning: #f59e0b; /* 警告色：橙色 */
    --danger: #ef4444; /* 危险色：红色 */
    --info: #3b82f6; /* 信息色：蓝色 */
    --gray-50: #f9fafb; /* 浅灰色 */
    --gray-100: #f3f4f6; /* 灰色 */
    --gray-200: #e5e7eb; /* 中灰色 */
    --gray-300: #d1d5db; /* 深灰色 */
    --gray-600: #4b5563; /* 文本灰色 */
    --gray-700: #374151; /* 深色文本 */
    --gray-800: #1f2937; /* 更深色文本 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 0.375rem; /* 6px */
    --radius: 0.5rem; /* 8px */
    --radius-lg: 0.75rem; /* 12px */
    --radius-xl: 1rem; /* 16px */
    --transition: all 0.2s ease-in-out;
}

.admin-container {
    min-height: 100vh;
    background-color: var(--gray-50);
    padding-top: 60px; /* 为吸顶头部预留空间 */
    background-image: radial-gradient(circle at top right, rgba(99, 102, 241, 0.05) 0%, transparent 50%);
}

/* 统一页面头部 */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    background-color: rgba(255, 255, 255, 0.85); /* 半透明背景 */
    backdrop-filter: blur(10px); /* 毛玻璃效果 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: fixed; /* 改为 fixed 定位，实现吸顶 */
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #eee;
}

.profile-name {
    font-weight: 500;
    color: #333;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #ddd;
    background-color: #fff;
    color: #333;
    border-radius: 8px;
    transition: all 0.3s;
}

.back-btn:active {
    background-color: #f0f0f0;
    border-color: #ccc;
}

/* 主要内容区 */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    gap: 24px;
}
.mobile .main-content {
    flex-direction: column;
    padding: 10px;
    padding-top: 15px; /* 在移动端为吸顶的 tab 预留空间 */
    gap: 15px;
}

/* 侧边菜单 */
.side-menu {
    width: 220px;
    background-color: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    align-self: flex-start; /* 防止在flex布局中被拉伸 */
    flex-shrink: 0;
}

.menu-scroll {
    height: 100%;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
    font-weight: 500;
}

.menu-item:last-child {
    margin-bottom: 0;
}

.menu-item .fa {
    width: 20px;
    text-align: center;
}

.menu-item:hover {
    background-color: #f4f4f8;
    color: #7B68EE;
}

.menu-item.active {
    background-color: #7B68EE;
    color: white;
    box-shadow: 0 4px 8px rgba(123, 104, 238, 0.3);
}

.mobile .side-menu {
    width: 100%;
    padding: 0;
    background: none;
    box-shadow: none;
    border-bottom: 1px solid #e0e0e0;
}

.mobile .menu-scroll {
    white-space: nowrap;
}

.mobile .menu-item {
    display: inline-flex; /* 使其横向排列 */
    width: auto;
    margin-bottom: 0;
    padding: 12px 18px;
    border-radius: 0;
}

.mobile .menu-item.active {
    border-bottom: 2px solid #7B68EE;
    background: none;
    color: #7B68EE;
    box-shadow: none;
    border-radius: 0;
}

.dark .mobile .menu-item.active {
    color: #9B88FF;
    border-bottom-color: #9B88FF;
}

.mobile .content-area {
    width: 100%;
    padding: 15px;
    box-shadow: none;
    background-color: transparent; /* 移动端内容区域透明，使用父级背景 */
}

/* 数据概览 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.stat-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 20px;
    margin: 10px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.stat-card:nth-child(1)::before { background-color: #3498db; }
.stat-card:nth-child(2)::before { background-color: #2ecc71; }
.stat-card:nth-child(3)::before { background-color: #9b59b6; }

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0,0,0,0.15);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    margin: 10px 0;
    color: #333;
}

.stat-change {
    font-size: 14px;
    padding: 3px 8px;
    border-radius: 12px;
    display: inline-block;
}

.stat-change.positive {
    background-color: rgba(46, 204, 113, 0.1);
    color: #27ae60;
}

.stat-change.negative {
    background-color: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.stat-card {
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.stat-header {
    display: flex;
    justify-content: center; /* 居中 */
    align-items: center;
    gap: 10px; /* 增加图标和文字的间距 */
    color: #666;
    margin-bottom: 16px;
    font-size: 16px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    margin: 12px 0;
    color: var(--gray-800);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.5px;
}

.stat-change {
    color: #666;
    font-size: 14px;
    margin-top: 8px;
    display: block;
}

/* 用户管理 */
.control-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.search-box {
    display: flex;
    align-items: center;
    background-color: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0 16px;
    flex: 1;
    max-width: 360px;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-box input {
    flex: 1;
    border: none;
    padding: 12px 8px;
    outline: none;
    font-size: 14px;
}

.search-btn {
    color: var(--gray-500);
    transition: color 0.2s;
}

.search-btn:hover {
    color: var(--primary);
}

.search-box input {
    flex: 1;
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.filter-box {
    display: flex;
    gap: 16px;
}

.filter-select,
.sort-select {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
}

.role-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.role-badge.admin {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.role-badge.user {
    background-color: #e3f2fd;
    color: #1976d2;
}

.action-btn.ban {
    background-color: #d32f2f;
}

.action-btn.unban {
    background-color: #388e3c;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 24px;
    gap: 8px;
    padding: 8px;
    background-color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.page-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background-color: white;
    border: 1px solid var(--gray-200);
    color: var(--gray-600);
    transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary-light);
    color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    padding: 0 12px;
    color: var(--gray-600);
    font-size: 14px;
}

.page-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    color: #666;
}

.uni-popup__wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.edit-modal {
    width: 90%;
    max-width: 500px;
    background-color: white;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transform: translateY(-10px);
    animation: modalSlideIn 0.3s ease forwards;
}

@keyframes modalSlideIn {
    to {
        transform: translateY(0);
    }
}

.modal-header {
    padding: 16px 20px;
    background-color: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
}

.modal-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 18px;
    font-weight: bold;
}

.modal-body {
    padding: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #666;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    transition: var(--transition);
    background-color: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    z-index: 1;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-700);
}

.modal-footer {
    padding: 16px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-cancel {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
}

.btn-confirm {
    padding: 8px 16px;
    background-color: #7B68EE;
    color: white;
    border-radius: 6px;
}

/* 用户管理样式 */
.user-table {
    overflow-x: auto;
}

.user-table table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.user-table th {
    padding: 14px 16px;
    text-align: left;
    background-color: var(--gray-50);
    color: var(--gray-600);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.user-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
    transition: background-color 0.2s;
}

.user-table tr:hover td {
    background-color: rgba(99, 102, 241, 0.03);
}

.user-table tr:nth-child(even) td {
    background-color: var(--gray-50);
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #666;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info image {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.status-badge.active {
    background-color: #e6f4ea;
    color: #1e8e3e;
}

.status-badge.banned {
    background-color: #fce8e6;
    color: #d93025;
}

.actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.action-btn.edit {
    background-color: #4285f4;
}

.action-btn.delete {
    background-color: #d93025;
}

/* 公告管理 */
.notices-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.section-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notice-form-card {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.form-header {
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.form-header .fa {
    margin-right: 10px;
    color: #007aff;
}

.notice-form-card .form-group:last-child {
    margin-bottom: 20px;
}
.notice-form-card input,
.notice-form-card textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.notice-form-card textarea {
    min-height: 200px;
    resize: vertical;
}
.submit-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: rgb(80, 102, 228);
    border: none;
    border-radius: var(--radius);
    padding: 12px;
    width: 100%;
    font-weight: 500;
    margin-top: 10px;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.25);
}

.submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    box-shadow: none;
}

.submit-btn:disabled {
    background-color: #cce5ff;
    cursor: not-allowed;
}

.notice-item {
    background-color: #fff;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    position: relative;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.item-title {
    font-weight: 600;
    font-size: 16px;
}

.item-date {
    font-size: 12px;
    color: #888;
}

.item-content {
    font-size: 14px;
    color: #555;
}

.item-delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #ff3b30;
    cursor: pointer;
    padding: 5px;
}

/* 加载中状态 */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    background-color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 40px 0;
}

.loading-state .fa {
    font-size: 24px;
    color: var(--primary);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.95);
    }
}

/* 空数据状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
    background-color: white;
    border-radius: var(--radius-lg);
    margin-top: 16px;
    box-shadow: var(--shadow-sm);
}

.empty-state .fa {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--gray-300);
}

.empty-state text {
    font-size: 16px;
    display: block;
    margin-top: 8px;
}

.empty-state text {
    color: #666;
    font-size: 14px;
}

/* 添加排序图标样式 */
.sort-icon {
    margin-left: 4px;
    cursor: pointer;
}

/* 添加加载状态样式 */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-mask {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-content {
    text-align: center;
    padding: 30px;
    background-color: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

/* 优化表格样式 */
.user-table {
    position: relative;
    margin-top: 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

/* 优化按钮样式 */
.action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    margin: 0 4px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.action-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 120%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 80%);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.4s ease;
}
.action-btn:active::after {
    transform: translate(-50%, -50%) scale(1);
}

.action-btn:hover {
    opacity: 0.8;
}

.action-btn.edit {
    background-color: var(--primary);
}

.action-btn.delete {
    background-color: var(--danger);
}

.action-btn.ban {
    background-color: var(--warning);
}

.action-btn.unban {
    background-color: var(--secondary);
}

.action-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn.ban {
    background-color: #f44336;
}

.action-btn.unban {
    background-color: #2196F3;
}

.action-btn.delete {
    background-color: #FF5722;
}

/* 状态标签样式 */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.status-badge.active {
    background-color: #E8F5E9;
    color: #2E7D32;
}

.status-badge.banned {
    background-color: #FFEBEE;
    color: #C62828;
}

/* 角色标签样式 */
.role-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.role-badge.admin {
    background-color: #E3F2FD;
    color: #1565C0;
}

.role-badge.user {
    background-color: #F3E5F5;
    color: #6A1B9A;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .admin-container.mobile {
        padding-top: 56px; /* 移动端头部高度 */
    }

    .admin-header {
        padding: 10px 15px;
    }
    
    .btn-text-desktop {
        display: none; /* 在移动端隐藏文字 */
    }

    .back-btn {
        min-width: 40px;
        padding: 8px;
    }
    
    .mobile .nav-tabs {
        flex-direction: column;
        align-items: stretch;
    }
    
    .mobile .tab {
        margin-bottom: 5px;
    }
    
    .mobile .user-table th,
    .mobile .user-table td {
        padding: 8px 4px;
        font-size: 12px;
        white-space: nowrap;
    }

    .mobile .user-actions button {
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .mobile .pagination button {
        padding: 6px 10px;
    }
}

/* 公告表单样式 */
.notice-form {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
}
.form-input, .form-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    box-sizing: border-box; /* 确保 padding 不会影响总宽度 */
}
.form-textarea {
    height: 80px;
    resize: vertical;
}
.form-submit-btn {
    background-color: #7B68EE;
    color: white;
}